import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";

import { createPinia } from "pinia";

// 如下为自定义工具函数
import { initAsyn_promise, initAsynCss_promise } from "/common/utils/loadJs";
import { setRem } from "/common/utils";
import 'normalize.css'
import '/common/assets/css/style/index.scss'

const store = createPinia();

// 为了在vue实例化之前先加载某些依赖，第一个参数为[]时，直接执行回掉；否则，先加载js，加载完成后执行回掉；
// const sourceArr = ['swiper'];
// const sourceCssArr = ['swiperCss'];
const sourceArr = [];
const sourceCssArr = [];
Promise.all([
  initAsyn_promise(sourceArr), // 初始化vue之前进行，某些资源的预加载
  initAsynCss_promise(sourceCssArr), // 预加载css
]).then(async () => {

  // 移动端rem配置
  setRem()

  const app = createApp(App);
  app.use(router);
  app.use(store);

  app.mount("#app");
})
